|||---------------------------------------------------------------------------------------------------------Expo Events
#event Expo "#1# #*# 'Expo'"
#event Playexpo "#1# says, 'Play Expo'"
#event continueExpo "#1# says, 'continue'"
#event stopExpo "#1# says, 'stop'"

Sub Event_Expo(Line, Player)
	/if (${Debug}) /echo in Event_Expo
	/varset Player ${Player.Right[-2].Left[-1]}
	/delay ${TellDelay}
	/tell ${Player} In this game, you place your bet and then roll 1-6 twice. If your total is 7, you win double your money. You may now [stop] or [go]. If you stop you win the money, if you go you must bet again and your new bet + your current bet and winnings are combined. Roll 6 twice again and if your total is 7 then you get quadruple your money. You may keep betting and exponetially increasing your winnings until you [stop] or lose. [Play Expo]?
/return
Sub Event_PlayExpo(Line, Player)
	/if (${Debug}) /echo in Event_PlayExpo
	/varset Player ${Player.Right[-2].Left[-1]}
	/if (!${Defined[${Player}]}) {
		/call BankedCheck ${Player}
		/if (!${Macro.Return}) /return
	}
	|||If player is still at blackjack or roulette table, don't let them switch games.
	/if (${${Player}[2]} == 3 || ${${Player}[2]} == 4) {
		/say ${Player}, Please wait until you are removed from your current table before starting a new game.
		/return
	}
|||-----------------------------------------------------------------------------------------------------------Expo Vars 	
	|||--------Player Array Settings
	/varset ${Player}[2] 6
	/call ResetPlayerStatus ${Player} 6
	|||-----Reset Player variables----- 4=BetMultiplier 5=Roll#1 6=Roll#2 7=TotalBet 8=Winnings
	
	/say ${Player}, Please place your bet for Expo and /ran 1-6 twice.
/return


sub Event_stopExpo(Line, Player)
	/if (${Debug}) /echo in Event_stopExpo
	/varset Player ${Player.Right[-2].Left[-1]}
	|||--Check Players ExpoStatus
	/if (${Defined[${Player}]} && ${${Player}[2]} == 6) {
		/if (${${Player}[8]}) {
			/delay ${TellDelay}
			/tell ${Player} Congratulations, you won a total of ${Math.Calc[${${Player[8]}-${${Player}[7]}.Int]} platinum!
			/call PlayerWins ${Player} ${${Player}[8]}
			/call ResetPlayerStatus ${Player} 6
		}
	}
/return

|||-----------------------------------------------------------------------------------------------Expo Continue Rolling
sub Event_continueExpo(Line, Player)
	/if (${Debug}) /echo in Event_continueExpo
	/varset Player ${Player.Right[-2].Left[-1]}

 	|||--Check Players ExpoStatus
	/if (${Defined[${Player}]} && ${${Player}[2]} == 6) {
		|||-------------------------------------------------Check for both rolls
		/if (${Math.Calc[${${Player}[5]}+${${Player}[6]}]} != 7) {
			/delay ${TellDelay}
			/tell ${Player} You must win your initial bet by rolling a 7 before you may continue.
		} else {
			/varset ${Player}[3] 0
			/varset ${Player}[4] ${Math.Calc[${${Player}[4]}+${${Player}[4]}].Int}
			/varset ${Player}[5] PENDING
			/varset ${Player}[6] PENDING
			/if (${Debug}) /echo Multiplier: ${${Player}[4]} + ${${Player}[4]} = ${Math.Calc[${${Player}[4]}+${${Player}[4]}].Int} ||  CurrentWinnings = ${${Player}[8]}
		}
		
	}
/return

|||----------------------------------------------------------------------------------------------------------------Expo
Sub PlayerExpo(Player, int RollMin, int RollMax, int Roll)
	/if (${Debug}) /echo in PlayerExpo
	|||--------------------------Validate roll
	/if (${RollMin} != 1 || ${RollMax} != 6) {
		/delay ${TellDelay}
		/tell ${Player} Your roll must be between 1 and 6. Please /random 1 6 to try again.
	} else {
		|||---------Validate bet
		/if (!${${Player}[3]}) {
			/delay ${TellDelay}
			/tell ${Player} You have to place a bet before you can continue playing.
		} else {
		
			|||------------------Record first roll
			/if (${${Player}[5].Equal[PENDING]}) {
				/varset ${Player}[5] ${Roll}
				/if (${Debug}) /echo in PlayerExpo First roll = ${${Player}[5]}
				
			|||---------------------------------------------------Record second roll
			} else /if (${Int[${${Player}[5]}]} && ${${Player}[6].Equal[PENDING]}) {
				/varset ${Player}[6] ${Roll}
				/if (${Debug}) /echo in PlayerExpo Second roll = /varset ${${Player}[6]}
			}
			
			|||---------------------------add rolls and Set win / loss
			/if (${Int[${${Player}[5]}]} && ${Int[${${Player}[6]}]}) {
				/call Add ${${Player}[5]} ${${Player}[6]}
				/if (${Debug}) /echo in PlayerExpo Roll total = ${Macro.Return}
				
				|||--------------PlayerLoses
				/if (${Macro.Return} != 7) {
					/delay ${TellDelay}
					/tell ${Player} Sorry, ${Player}, you rolled a ${Macro.Return} but needed a 7 to win.  Better luck next time.
					/call PlayerLoses ${Player} ${${Player}[3]}
					/call ResetPlayerStatus ${Player} 6
				} else {
					
					|||---------------PlayerWins
					
					/if (${Debug}) /echo Add new bet + standing bet [${${Player}[3]} + ${${Player}[7]} = ${Math.Calc[${${Player}[3]}+${${Player}[7]}].Int}]
					/varset ${Player}[7] ${Math.Calc[${${Player}[3]}+${${Player}[7]}].Int}
					
					/if (${Debug}) /echo Calc Bet + Winnings x Multiplier [${${Player}[7]} + ${${Player}[8]} x ${${Player}[4]} = ${Math.Calc[${Math.Calc[${${Player}[7]}+${${Player}[8]}]}*${${Player}[4]}].Int}]
					/varset ${Player}[8] ${Math.Calc[${Math.Calc[${${Player}[7]}+${${Player}[8]}]}*${${Player}[4]}].Int}
					
					/tell ${Player} You won ${Math.Calc[${${Player}[8]}-${${Player}[7]}].Int}!  You may [stop] now to collect your winnings, or you may [continue] for a chance to win ${Math.Calc[${${Player}[4]}+${${Player}[4]}].Int}x your standing bet.	
				}		
			}	
		}
	}
/return